#!/bin/bash
# Zaitan Module - Codecs Install
# Zaitan Team <http://code.google.com/p/zaitan/>

RMOD_ENGINE='3.0'
RMOD_CATEGORY='Software'
RMOD_SUBCATEGORY='Multimedia'
RMOD_NAME='Codecs'
RMOD_AUTHOR='Zaitan Team'
RMOD_VERSION='feisty'
RMOD_DESCRIPTION='Installs Codecs'
RMOD_UPDATE_URL='http://code.google.com/p/Zaitan/'

# install Codecs for linux
echo Running $RMOD_NAME...
#/usr/lib/zaitan/modulo/mod-checkInstall

# update e Codecs
apt-get update
debs='gstreamer0.10-ffmpeg gstreamer0.10-gl gstreamer0.10-plugins-good gstreamer0.10-pitfdll gstreamer0.10-plugins-bad libdvdread3 cpdvd faac faad ffmpeg flac lame mp3gain gqmpeg mpg321 mpg123 x264 sox mjpegtools libdc1394-13-dev libxine1-ffmpeg gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-sdl mencoder gstreamer0.10-gnonlin'


for i in $debs; do

VERIFIQ=$(dpkg -s "$i" | grep "Status:" | awk '{ print $3 }')


	if [ "$VERIFIQ" != "ok" ]; then

	apt-get -y install $i
	sleep 1
	
	else
	echo "$i `dpkg -s $i | grep Status`"
	sleep 2
fi

done


i='w32codecs'
VERIFIQ=$(dpkg -s "$i" 2> /dev/null | grep "Status:" | awk '{ print $3 }')


	if [ "$VERIFIQ" != "ok" ]; then

		cd /usr/share/zaitan
		wget -c http://www.debian-multimedia.org/pool/main/w/w32codecs/w32codecs_20071007-0.0_i386.deb
		dpkg -i w32codecs_20071007-0.0_i386.deb
	
	else
		echo "$i já está instalado"
	sleep 2
fi


echo $RMOD_NAME Finibashed...

##Logs
echo $RMOD_NAME-$RMOD_VERSION | tee -a /usr/share/zaitan/logs
/usr/lib/zaitan/modulo/mod-logs
##

exit 0

